<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>lhx个人博客</title><meta name="keywords" content="前端基础CSS、Js、Vue、React、移动端、小程序、网络"><meta name="author" content="李汉鑫"><meta name="copyright" content="李汉鑫"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="前端基础CSS、Js、Vue、React、移动端、小程序、网络">
<meta property="og:type" content="website">
<meta property="og:title" content="lhx个人博客">
<meta property="og:url" content="http://example.com/page/3/index.html">
<meta property="og:site_name" content="lhx个人博客">
<meta property="og:description" content="前端基础CSS、Js、Vue、React、移动端、小程序、网络">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img2.baidu.com/it/u=203845187,735199026&fm=26&fmt=auto&gp=0.jpg">
<meta property="article:author" content="李汉鑫">
<meta property="article:tag" content="前端基础CSS、Js、Vue、React、移动端、小程序、网络">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://img2.baidu.com/it/u=203845187,735199026&fm=26&fmt=auto&gp=0.jpg"><link rel="shortcut icon" href="https://img2.baidu.com/it/u=1328275982,1207856622&fm=26&fmt=auto&gp=0.jpg"><link rel="canonical" href="http://example.com/page/3/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'lhx个人博客',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2021-09-01 22:26:54'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/atom.xml" title="lhx个人博客" type="application/atom+xml">
</head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://img2.baidu.com/it/u=203845187,735199026&amp;fm=26&amp;fmt=auto&amp;gp=0.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">31</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 文章</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">lhx个人博客</a></span><div id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 文章</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">lhx个人博客</h1><div id="site-subtitle"><span id="subtitle"></span></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/JavaScript/Ajax/" title="Ajax">     <img class="post_bg" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Ajax"></a></div><div class="recent-post-info"><a class="article-title" href="/JavaScript/Ajax/" title="Ajax">Ajax</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-04-19T11:30:21.000Z" title="发表于 2018-04-19 19:30:21">2018-04-19</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/JavaScript/">JavaScript</a></span></div><div class="content">XMLHttpRequest对象
浏览器内建对象，用于与服务器通信(交换数据) ， 由此我们便可实现对网页的部分更新，而不是刷新整个页面。这个请求是异步的，即在往服务器发送请求时，并不会阻碍程序的运行，浏览器会继续渲染后续的结构。

1请求由客户端发起，其规范格式为：请求行、请求头、请求主体。





发送get请求XMLHttpRequest以异步的方式发送HTTP请求，因此在发送请求时，一样需要遵循HTTP协议。

使用XMLHttpRequest发送get请求的步骤

12345678910111213141516//1. 创建一个XMLHttpRequest对象var xhr = new XMLHttpRequest();//2. 设置请求行// 第一个参数:请求方式  get/post// 第二个参数:请求的地址 需要在url后面拼上参数列表// 第三个参数: 是否异步请求,默认是true  true就是异步,false是同步xhr.open(&quot;get&quot;, &quot;http://localhost:5000/test?name=haha&quot;) ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/Vue/vue-router/" title="vue-router">     <img class="post_bg" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="vue-router"></a></div><div class="recent-post-info"><a class="article-title" href="/Vue/vue-router/" title="vue-router">vue-router</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-03-26T13:42:39.000Z" title="发表于 2018-03-26 21:42:39">2018-03-26</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Vue/">Vue</a></span></div><div class="content">1. vue-router是用来实现SPA的vue插件

2. vue-router的基本使用1). 创建路由器: router/index.js
    new VueRouter(&#123;
      mode: &#39;hash/history&#39;
      routes: [
        &#123; // 一般路由
          path: &#39;/about&#39;,
          component: About
        &#125;,
        &#123; // 自动跳转路由
          path: &#39;/&#39;,
          redirect: &#39;/about&#39;
        &#125;
      ]
    &#125;)
2). 注册路由器: main.js
    import router from &#39;./router&#39;
    new Vue(&#123;
      router
    &#125;)
3). 使用路由组件标签:
    & ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/Vue/%E9%A1%B9%E7%9B%AE%E5%B0%8F%E7%BB%93/" title="项目小结">     <img class="post_bg" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="项目小结"></a></div><div class="recent-post-info"><a class="article-title" href="/Vue/%E9%A1%B9%E7%9B%AE%E5%B0%8F%E7%BB%93/" title="项目小结">项目小结</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-03-18T13:08:15.000Z" title="发表于 2018-03-18 21:08:15">2018-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Vue/">Vue</a></span></div><div class="content">技术栈总结
vue 基础语法
123456789101112131415161718- 条件渲染：``` v-if v-show```- 列表渲染：``v-for key``- 数据绑定 : ```v-bind(简写:)```- 事件绑定：```@+事件名```- 组件配置对象 （选项）  - 11个生命周期钩子函数  - computed：计算属性  - watch：监视属性  - methods：方法的声明  - props：接收父组件向子组件传递的数据  - mixins：混合  - components：注册组件


通过npm下载的包
1234567891011121314- axios：用于发送ajax请求，可以添加请求拦截器，对公共的请求进行统一的处理，可以设置请求地址公共前缀，请求头header携带的信息等等；也可以添加相应的响应拦截器，对响应结果进行统一的拦截处理，让返回的正确结果只有功能成功的数据- lodash：一个丰富的工具函数库，可以对数据、对象、字符串等进行相应的处理，例如数组的深拷贝等等- mockjs：可以进行模拟数据，可在本地模拟请求服务器的数据- n ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/CSS%E9%87%8D%E7%82%B9/%E6%B0%B4%E5%B9%B3%E5%9E%82%E7%9B%B4%E5%B1%85%E4%B8%AD/" title="水平垂直居中">     <img class="post_bg" src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="水平垂直居中"></a></div><div class="recent-post-info"><a class="article-title" href="/CSS%E9%87%8D%E7%82%B9/%E6%B0%B4%E5%B9%B3%E5%9E%82%E7%9B%B4%E5%B1%85%E4%B8%AD/" title="水平垂直居中">水平垂直居中</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-03-09T14:10:27.000Z" title="发表于 2018-03-09 22:10:27">2018-03-09</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/CSS/">CSS</a></span></div><div class="content">居中(水平居中)
内联元素水平居中（父元素上加，父元素必须块元素或行内块状元素）
12345678910111213141516171819&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;    &lt;style&gt;        #f&#123;            border:1px solid green;            text-align: center;        &#125;    &lt;/style&gt;&lt;/head&gt;&lt;body&gt;    &lt;div id=&quot;f&quot;&gt;        abc&lt;div style=&quot;display:inline-block;&quot;&gt;123&lt;/div&gt;        &lt;div style=&quot;border:1px solid blue;width:100px;height:100px;&quot;&gt;1&lt;/div&gt;    &lt;/div&gt;&lt;/b ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/CSS%E9%87%8D%E7%82%B9/BFC%E6%A8%A1%E5%9E%8B/" title="BFC模型">     <img class="post_bg" src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="BFC模型"></a></div><div class="recent-post-info"><a class="article-title" href="/CSS%E9%87%8D%E7%82%B9/BFC%E6%A8%A1%E5%9E%8B/" title="BFC模型">BFC模型</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-03-07T12:11:30.000Z" title="发表于 2018-03-07 20:11:30">2018-03-07</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/CSS/">CSS</a></span></div><div class="content">BFC一个块格式化上下文（block formatting context），是web页面的可视化CSS渲染出的一部分。形成了BFC就形成了独立的区域，区域里面的子元素不会影响到外面的元素。
形成BFC：

浮动元素：元素的float不是none的元素。
绝对定位：position的值为absolute或fixed。
内联块：display:inline-block;
具有overflow并且值不是visible的块元素。
display的值为flow-root（CSS3中新增加的，只是单纯的触发BFC）。

1、2、3、4也能形成BFC但是它还有自己的特性。flow-root只是单纯的触发BFC。
形成BFC之后通常用来做的事：

爸爸管儿子，来让爸爸抱抱。（父元素上使用）

解决float高度塌陷问题。
123456789101112131415161718192021222324252627&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt;    &lt;style&gt;        #f&#123;            width: ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/CSS%E9%87%8D%E7%82%B9/Flex%E5%B8%83%E5%B1%80/" title="Flex布局">     <img class="post_bg" src="https://i.loli.net/2020/05/01/gkihqEjXxJ5UZ1C.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Flex布局"></a></div><div class="recent-post-info"><a class="article-title" href="/CSS%E9%87%8D%E7%82%B9/Flex%E5%B8%83%E5%B1%80/" title="Flex布局">Flex布局</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-03-07T05:21:39.000Z" title="发表于 2018-03-07 13:21:39">2018-03-07</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/CSS/">CSS</a></span></div><div class="content">弹性盒布局也叫弹性布局、弹性盒子、flex布局、伸缩布局、伸缩盒子。
弹性盒子是一种简单、强大的布局方式。通过弹性盒子可以指明空间的分布方式、内容的对齐方式、元素的视觉顺序。弹性盒子最适合用于沿着一个方向进行内容的分配。
最大特点：让元素对不同屏幕尺寸和不同显示设备做好适应准备。
弹性布局：父-》子关系。父元素和子元素之间的关系。
父元素：弹性空间或弹性容器。
子元素：弹性项或弹性元素。
弹性容器弹性容器属性比较多，经常用到的属性也是弹性容器上的属性。
父元素上直接设置display:flex就已经激活了弹性盒子布局。这个元素就成为了弹性元素。
弹性容器负责在所占的空间内布置子内容，控制子内容的布局。
父元素设置了display:flex，子元素横向排列（而且不塌陷）。并且当父元素宽度小于这些子元素的总宽度的时候回自动伸缩。
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455&lt;!DOCTYPE html&gt;&lt;html&g ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/Vue/%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83/" title="搭建环境">     <img class="post_bg" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="搭建环境"></a></div><div class="recent-post-info"><a class="article-title" href="/Vue/%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83/" title="搭建环境">搭建环境</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-03-06T13:16:48.000Z" title="发表于 2018-03-06 21:16:48">2018-03-06</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Vue/">Vue</a></span></div><div class="content">1. 初始化项目1). 生成package.json
    yarn init -y

2). 创建入口js: src/index.js
    console.log(&#39;Hello Webpack!&#39;)
    document.getElementById(&#39;root&#39;).innerHTML = &#39;&lt;h1&gt;Hello222&lt;/h1&gt;&#39;

3). 创建页面文件: public/index.html
    &lt;div id=&quot;root&quot;&gt;&lt;/div&gt;

2. webpack基本使用1). 下载依赖包
    npm remove webpack webpack-cli -g
    npm install -D webpack webpack-cli
    npm install -D html-webpack-plugin

2). 创建webpack配置: webpack.config.js
    const path = require(&#39;path&# ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/Vue/%E8%84%9A%E6%89%8B%E6%9E%B6/" title="脚手架">     <img class="post_bg" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="脚手架"></a></div><div class="recent-post-info"><a class="article-title" href="/Vue/%E8%84%9A%E6%89%8B%E6%9E%B6/" title="脚手架">脚手架</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-02-23T12:17:40.000Z" title="发表于 2018-02-23 20:17:40">2018-02-23</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Vue/">Vue</a></span></div><div class="content">1. vue的脚手架脚手架V2: 相对老的项目
脚手架v3: 较新的项目
脚手架v4: 最新的

使用vue的脚手架npm install -g @vue/cli    3的脚手架
vue create vue-app3  

npm install -g @vue/cli-init  2的脚手架
vue init webpack vue-app2   

npm install -g vue-cli  2的脚手架(老的, 现在不用了)
vue init webpack vue-app2

比较V2与V3创建的项目1. v2的配置是直接可见, v3是包装隐藏起来了
2. 修改配置: v2是直接在配置文件中修改, v3提供了一个专门的配置: vue.config.js, 我们可以根据文档在此文件中添加配置
3. vue使用的是不带编译器的版本, 打包文件更小  不写template配置, 直接render配置

</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/Vue/%E9%A1%B9%E7%9B%AE%E4%BC%98%E5%8C%96/" title="项目优化">     <img class="post_bg" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="项目优化"></a></div><div class="recent-post-info"><a class="article-title" href="/Vue/%E9%A1%B9%E7%9B%AE%E4%BC%98%E5%8C%96/" title="项目优化">项目优化</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-02-23T12:17:40.000Z" title="发表于 2018-02-23 20:17:40">2018-02-23</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Vue/">Vue</a></span></div><div class="content">1. Vue代码层面优化1) v-for 遍历列表指定非下标的唯一key
不同时使用 v-if
2) 图片资源懒加载如使用v-lazyload
3) 路由组件懒加载const Home = () =&gt; import(‘./pages/Home’)
4) 第三方插件的按需引入如: element-ui / vant 
5) 大数组优化1: 冻结响应式数据当前组件如果只是为纯展示组件时，拿到数据后使用Object.freeze()将数据冻结，这样数据就无法进行响应变化。
123456789export default &#123;  data: () =&gt; (&#123;    users: []  &#125;),  async created() &#123;    const users = await axios.get(&quot;/api/users&quot;);    this.users = Object.freeze(users); // 这样数组内部就没有做数据劫持处理, 效率更高  &#125;&#125;;



6) 大数组优化2: 虚拟列表
当组件 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/Vue/%E7%AE%80%E4%BB%8B/" title="搭建环境">     <img class="post_bg" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="搭建环境"></a></div><div class="recent-post-info"><a class="article-title" href="/Vue/%E7%AE%80%E4%BB%8B/" title="搭建环境">搭建环境</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2018-02-21T11:27:39.000Z" title="发表于 2018-02-21 19:27:39">2018-02-21</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Vue/">Vue</a></span></div><div class="content">自定义Vue开发环境1. 搭建基本开发环境1). 下载依赖包
    yarn add -D webpack webpack-cli
    yarn add -D html-webpack-plugin
    yarn add -D webpack-dev-server
    yarn add -D babel-loader @babel/core @babel/preset-env
    yarn add -D css-loader style-loader
    yarn add -D url-loader@2.3.0 file-loader@4.3.0

2). webpack的基本配置: webpack.config.js
    module.exports = &#123;
      mode: &#39;production|development&#39;
      entry: &#123;

      &#125;,
      output: &#123;

      &#125;,
      module: &#123;
        ru ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/page/2/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><a class="page-number" href="/page/2/#content-inner">2</a><span class="page-number current">3</span><a class="page-number" href="/page/4/#content-inner">4</a><a class="extend next" rel="next" href="/page/4/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://img2.baidu.com/it/u=203845187,735199026&amp;fm=26&amp;fmt=auto&amp;gp=0.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">李汉鑫</div><div class="author-info__description">前端基础CSS、Js、Vue、React、移动端、小程序、网络</div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/archives/"><div class="headline">文章</div><div class="length-num">31</div></a></div><div class="card-info-data-item"><a href="/tags/"><div class="headline">标签</div><div class="length-num">0</div></a></div><div class="card-info-data-item"><a href="/categories/"><div class="headline">分类</div><div class="length-num">10</div></a></div></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">个人网站,欢迎交流</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/%E7%A7%BB%E5%8A%A8%E7%AB%AF/%E7%A7%BB%E5%8A%A8%E7%AB%AF/" title="移动端"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="移动端"/></a><div class="content"><a class="title" href="/%E7%A7%BB%E5%8A%A8%E7%AB%AF/%E7%A7%BB%E5%8A%A8%E7%AB%AF/" title="移动端">移动端</a><time datetime="2021-06-07T09:21:39.000Z" title="发表于 2021-06-07 17:21:39">2021-06-07</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%B0%8F%E7%A8%8B%E5%BA%8F/" title="小程序基础"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="小程序基础"/></a><div class="content"><a class="title" href="/%E5%B0%8F%E7%A8%8B%E5%BA%8F/%E5%B0%8F%E7%A8%8B%E5%BA%8F/" title="小程序基础">小程序基础</a><time datetime="2021-05-03T05:20:10.000Z" title="发表于 2021-05-03 13:20:10">2021-05-03</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/%E7%BD%91%E7%BB%9C/http%E5%8D%8F%E8%AE%AE%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B%E5%92%8C%E5%9B%9B%E6%AC%A1%E6%8C%A5%E6%89%8B/" title="http协议三次握手和四次挥手"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="http协议三次握手和四次挥手"/></a><div class="content"><a class="title" href="/%E7%BD%91%E7%BB%9C/http%E5%8D%8F%E8%AE%AE%E4%B8%89%E6%AC%A1%E6%8F%A1%E6%89%8B%E5%92%8C%E5%9B%9B%E6%AC%A1%E6%8C%A5%E6%89%8B/" title="http协议三次握手和四次挥手">http协议三次握手和四次挥手</a><time datetime="2020-10-25T13:40:49.000Z" title="发表于 2020-10-25 21:40:49">2020-10-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/%E7%BD%91%E7%BB%9C/%E5%9C%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%9C%B0%E5%9D%80%E6%A0%8F%E8%BE%93%E5%85%A5url%E7%84%B6%E5%90%8E%E6%95%B2%E5%87%BB%E5%9B%9E%E8%BD%A6%E4%B9%8B%E5%90%8E%E9%83%BD%E5%81%9A%E4%BA%86%E4%BB%80%E4%B9%88/" title="在浏览器地址栏输入url然后敲击回车之后都做了什么"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="在浏览器地址栏输入url然后敲击回车之后都做了什么"/></a><div class="content"><a class="title" href="/%E7%BD%91%E7%BB%9C/%E5%9C%A8%E6%B5%8F%E8%A7%88%E5%99%A8%E5%9C%B0%E5%9D%80%E6%A0%8F%E8%BE%93%E5%85%A5url%E7%84%B6%E5%90%8E%E6%95%B2%E5%87%BB%E5%9B%9E%E8%BD%A6%E4%B9%8B%E5%90%8E%E9%83%BD%E5%81%9A%E4%BA%86%E4%BB%80%E4%B9%88/" title="在浏览器地址栏输入url然后敲击回车之后都做了什么">在浏览器地址栏输入url然后敲击回车之后都做了什么</a><time datetime="2020-10-24T14:10:19.000Z" title="发表于 2020-10-24 22:10:19">2020-10-24</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/%E7%BD%91%E7%BB%9C/%E8%AF%B7%E6%B1%82%E5%93%8D%E5%BA%94%E6%8A%A5%E6%96%87/" title="请求响应报文"><img src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/img/default.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="请求响应报文"/></a><div class="content"><a class="title" href="/%E7%BD%91%E7%BB%9C/%E8%AF%B7%E6%B1%82%E5%93%8D%E5%BA%94%E6%8A%A5%E6%96%87/" title="请求响应报文">请求响应报文</a><time datetime="2020-10-24T12:21:39.000Z" title="发表于 2020-10-24 20:21:39">2020-10-24</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            <a class="card-more-btn" href="/categories/" title="查看更多">
    <i class="fas fa-angle-right"></i></a>
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/CSS/"><span class="card-category-list-name">CSS</span><span class="card-category-list-count">3</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/JavaScript/"><span class="card-category-list-name">JavaScript</span><span class="card-category-list-count">3</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/React/"><span class="card-category-list-name">React</span><span class="card-category-list-count">5</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Vue/"><span class="card-category-list-name">Vue</span><span class="card-category-list-count">9</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/node-js/"><span class="card-category-list-name">node.js</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E4%BB%A3%E7%A0%81%E7%AE%A1%E7%90%86/"><span class="card-category-list-name">代码管理</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%B0%8F%E7%A8%8B%E5%BA%8F/"><span class="card-category-list-name">小程序</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%B7%A5%E7%A8%8B%E5%8C%96/"><span class="card-category-list-name">工程化</span><span class="card-category-list-count">2</span></a></li>
            </ul></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span><a class="card-more-btn" href="/archives/" title="查看更多">
    <i class="fas fa-angle-right"></i></a></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/06/"><span class="card-archive-list-date">六月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/05/"><span class="card-archive-list-date">五月 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/10/"><span class="card-archive-list-date">十月 2020</span><span class="card-archive-list-count">4</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/08/"><span class="card-archive-list-date">八月 2020</span><span class="card-archive-list-count">5</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2020/07/"><span class="card-archive-list-date">七月 2020</span><span class="card-archive-list-count">3</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2019/07/"><span class="card-archive-list-date">七月 2019</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2018/07/"><span class="card-archive-list-date">七月 2018</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2018/04/"><span class="card-archive-list-date">四月 2018</span><span class="card-archive-list-count">4</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">31</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2021-09-01T14:26:54.036Z"></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2021 By 李汉鑫</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function subtitleType () {
  if (false) { 
    window.typed = new Typed("#subtitle", {
      strings: ["世界上只有一种真正的英雄主义，那就是在认清生活的真相后依然热爱生活"],
      startDelay: 300,
      typeSpeed: 150,
      loop: true,
      backSpeed: 50
    })
  } else {
    document.getElementById("subtitle").innerHTML = '世界上只有一种真正的英雄主义，那就是在认清生活的真相后依然热爱生活'
  }
}

if (false) {
  if (typeof Typed === 'function') {
    subtitleType()
  } else {
    getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
  }
} else {
  subtitleType()
}</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>